package com.example.myapplication5;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

public class MobileAdapter extends ArrayAdapter<Mobilephone> {
 private int resoudrId;

 public MobileAdapter(Context context, int computerId, List<Mobilephone> objects){
     super(context,computerId,objects);
     resoudrId=computerId;

 }
 public View getView(int position, View convertView, ViewGroup parent){
     Mobilephone mo=getItem(position);
     View view;
     ViewHolder viewHolder;
     if(convertView==null){
         view= LayoutInflater.from(getContext()).inflate(resoudrId,parent,false);
         viewHolder=new ViewHolder();
         viewHolder.phoneOrder=(TextView) view.findViewById(R.id.phone_order);
         viewHolder.phoneGrand=(TextView) view.findViewById(R.id.phone_name);
         viewHolder.phoneSearch=(TextView) view.findViewById(R.id.phone_search);
         viewHolder.phoneQuake=(TextView) view.findViewById(R.id.phone_c);
     }else {
        view=convertView;
        viewHolder=(ViewHolder) view.getTag();
     }
     viewHolder.phoneOrder.setText(mo.getOrderId()+"");
     viewHolder.phoneGrand.setText(mo.getGrand());
     viewHolder.phoneSearch.setText(mo.getSearch()+"");
     return view;
 }
 class ViewHolder{
    TextView phoneOrder;
    TextView phoneGrand;
    TextView phoneSearch;
    TextView phoneQuake;
 }
}
